[IA64] postat tool
authorawilliam@xenbuild.aw <awilliam@xenbuild.aw>
Thu, 16 Mar 2006 19:13:23 +0000 (12:13 -0700)
committerawilliam@xenbuild.aw <awilliam@xenbuild.aw>
Thu, 16 Mar 2006 19:13:23 +0000 (12:13 -0700)
Small utility to display and clear privop statistics.

Signed-off-by: Tristan Gingold <tristan.gingold@bull.net>
xen/arch/ia64/tools/privop/Makefile [new file with mode: 0644]
xen/arch/ia64/tools/privop/pohcalls.S [new file with mode: 0644]
xen/arch/ia64/tools/privop/postat.c [new file with mode: 0644]

diff --git a/xen/arch/ia64/tools/privop/Makefile b/xen/arch/ia64/tools/privop/Makefile
new file mode 100644 (file)
index 0000000..c4e9b1c
--- /dev/null
@@ -0,0 +1,11 @@
+CC=gcc
+CFLAGS=-O -Wall
+
+all: postat
+
+postat: postat.c pohcalls.o
+
+clean:
+       $(RM) -f *.o postat *.s *~
+
+
diff --git a/xen/arch/ia64/tools/privop/pohcalls.S b/xen/arch/ia64/tools/privop/pohcalls.S
new file mode 100644 (file)
index 0000000..d58b127
--- /dev/null
@@ -0,0 +1,30 @@
+       .file   "hypercall.S"
+       .pred.safe_across_calls p1-p5,p16-p63
+       .text
+       .align 16
+       .global dump_privop_counts#
+       .proc dump_privop_counts#
+dump_privop_counts:
+       .prologue
+       .body
+       mov r2 = 0xffff
+       ;;
+       break 0x1000
+       ;; 
+       br.ret.sptk.many b0
+       ;;
+       .endp dump_privop_counts#
+       .align 16
+       .global zero_privop_counts#
+       .proc zero_privop_counts#
+zero_privop_counts:
+       .prologue
+       .body
+       mov r2 = 0xfffe
+       ;;
+       break 0x1000
+       ;; 
+       br.ret.sptk.many b0
+       ;;
+       .endp zero_privop_counts#
+
diff --git a/xen/arch/ia64/tools/privop/postat.c b/xen/arch/ia64/tools/privop/postat.c
new file mode 100644 (file)
index 0000000..fc96e15
--- /dev/null
@@ -0,0 +1,27 @@
+#include <stdio.h>
+#include <string.h>
+
+extern int dump_privop_counts (char *buf, int len);
+
+extern int zero_privop_counts (char *buf, int len);
+
+int
+main (int argc, char *argv[])
+{
+  static char buf[8192];
+  int res;
+
+  if (argc == 1)
+    res = dump_privop_counts (buf, sizeof (buf));
+  else if (argc == 2 && strcmp (argv[1], "--clear") == 0)
+    res = zero_privop_counts (buf, sizeof (buf));
+  else
+    {
+      printf ("usage: %s [--clear]\n", argv[0]);
+      return 1;
+    }
+  printf ("res=%d\n", res);
+  fputs (buf, stdout);
+
+  return 0;
+}